/*
 *  AddNewTaskAction.java
 *
 *  Course Project for User Interface Programming I, 2011
 *  Group 19
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version 2
 *  of the License, or any later version.
 *
 */
package justdoit.actions;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
import javax.swing.KeyStroke;
import justdoit.controller.LanguageManager;
import justdoit.controller.IconManager;
import justdoit.view.NewTaskDialog;

/**
 * This is for performing action of adding new task to a task list
 * when "Add New Task" item is clicked by user
 *
 * @author Can
 */
public class AddNewTaskAction extends AbstractAction {

    public AddNewTaskAction() {
        super(LanguageManager.getString("menu.task.addNewTask"), IconManager.getIcon("addTask.png"));
        putValue(MNEMONIC_KEY, LanguageManager.getMnemonic("mnemonic.menu.task.addNew"));
        putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("control N"));
    }

    public AddNewTaskAction(String text) {
        super(text);
    }

    public AddNewTaskAction(String text, ImageIcon icon) {
        super(text, icon);
    }

    public AddNewTaskAction(String text, ImageIcon icon,
            String desc, Integer mnemonic) {
        super(text, icon);
        putValue(SHORT_DESCRIPTION, desc);
        putValue(MNEMONIC_KEY, mnemonic);
    }

    public void actionPerformed(ActionEvent e) {
        NewTaskDialog ntd = new NewTaskDialog();
        ntd.setVisible(true);
    }
}
